<?php

namespace common\validate;

class Task extends BaseValidate
{
    // 验证规则
    protected $rule = [];


    // Select 验证场景定义
    public function sceneSelect()
    {
        return $this->append('param', 'require')
            ->append('param.filter', 'array')
            ->append('param.page', 'array');
    }

    // Create 验证场景定义
    public function sceneCreate()
    {
        return $this->append('data', 'require|array');
    }

    // Update 验证场景定义
    public function sceneUpdate()
    {
        return $this->append('data', 'require|array');
    }

    // BatchUpdate 验证场景定义
    public function sceneBatchUpdate()
    {
        $this->append('data_list', 'require|array');
    }

    // Delete 验证场景定义
    public function sceneDelete()
    {
        return $this->append('param.filter', 'require');
    }

    // SetEntityTaskLeader 验证场景定义
    public function sceneSetEntityTaskLeader()
    {
        return $this->append("task.id", "require")
            ->append("task.executor.union_id", "require")
            ->append("task.assignee", "require");
    }

    // SetTaskStepExecutorItem 验证场景定义
    public function sceneSetTaskStepExecutorItem()
    {
        return $this->append("task_id", "require|integer")
            ->append("executor_id", "require|integer");
    }

    // SetTaskStepExecutor 验证场景定义
    public function sceneSetTaskStepExecutor()
    {
        return $this->append("tasks", "require|array");
    }

    // GetEntityTaskTree 验证场景定义
    public function sceneGetEntityTaskTree()
    {
        return $this->append('module_code', 'require')
            ->append("param.filter", 'require')
            ->append("param.filter.entity_id", 'integer')
            ->append("param.only_total", 'in:yes,no')
            ->append("param.show_child", 'integer')
            ->append("param.page", 'array');
    }

    // GetPersonalTaskStatistics 验证场景定义
    public function sceneGetPersonalTaskStatistics()
    {
        return $this;
    }

    // GetPersonalExecuteTaskList 验证场景定义
    public function sceneGetPersonalExecuteTaskList()
    {
        return $this->append('param', 'require')
            ->append('param.filter', 'array')
            ->append('param.page', 'array');
    }

    // GetTaskWaitForAssign 验证场景定义
    public function sceneGetEntityTaskWaitForAssign()
    {
        return $this->append("param.module_code", 'require')
            ->append("param.project_id", 'require|integer')
            ->append("param.tasks", 'min:1');
    }

    // GetStepTaskWaitForAssign 验证场景定义
    public function sceneGetStepTaskWaitForAssign()
    {
        return $this
            ->append("param.project_id", 'integer')
            ->append("param.tasks", 'max:1000');
    }

    // GetTeamLeaderTaskTree 验证场景定义
    public function sceneGetTeamLeaderTaskTree()
    {
        return $this
            ->append("param.project_id", 'integer')
            ->append("param.task_step_type", 'in:step,step_category');
    }

    // GetTaskStepWorkFlowConfig 验证场景定义
    public function sceneGetTaskStepWorkflowConfig()
    {
        return $this->append("param.task_id", 'require|integer');
    }

    // GetTaskDetail 验证场景定义
    public function sceneGetTaskDetail()
    {
        return $this->append("param.task_id", 'require|integer');
    }

    // GetEntityTaskTreeByStepCategoryCode 验证场景定义
    public function sceneGetTaskTreeByStepCategoryCode()
    {
        return $this->append('param.filter.step_category_code', 'require|array')
            ->append("param.filter.project_id", 'require|integer')
            ->append("param.filter", 'require')
            ->append("param.filter.entity_id", 'integer')
            ->append("param.only_total", 'in:yes,no')
            ->append("param.page", 'array')
            ->append("param.filter.task_step_type", 'in:step,step_category');
    }

    // UpdateSEDate 验证场景定义
    public function sceneUpdateSEDate()
    {
        return $this->append("data", "require|array");
    }

    // UpdateSEDate 验证场景定义
    public function sceneUpdateSEDateItem()
    {
        return $this->append("id", "require|integer")
            ->append("plan_start_time", "require|date")
            ->append("plan_end_time", "require|date|gt:plan_start_time")
            ->append("plan_duration", "require");
    }

    // GetCheckListWithProgress 验证场景定义
    public function sceneGetCheckListWithProgress()
    {
        return $this->append("param", "require")
            ->append("param.filter.task_id", "require|integer");
    }

    // SelectReview 验证场景定义
    public function sceneSelectReview()
    {
        return $this->append("param", "require|array")
            ->append("param.filter.task_id", "require|integer");
    }

    // GetMarkedCheckList 验证场景定义
    public function sceneGetMarkedCheckList()
    {
        return $this->append("param", "require|array")
            ->append("param.filter.task_id", "require|integer");
    }

    // GetLatestCheckItem 验证场景定义
    public function sceneGetLatestCheckItem()
    {
        return $this->append("param", "require|array")
            ->append("param.filter.task_id", "require|integer");
    }

    // SelectAbnormalTaskList 验证场景定义
    public function sceneSelectAbnormalTaskList()
    {
        return $this->append('param', 'require')
            ->append('role_code', 'require')
            ->append('param.filter', 'array')
            ->append('param.page', 'array');
    }

    // GetTaskCategoryStatistics 验证场景定义
    public function sceneGetTaskCategoryStatistics()
    {
        return $this->append("param.filter.project_id", "integer");
    }

    // GetTeamTaskManHourStatistics 验证场景定义
    public function sceneGetTeamTaskManHourStatistics()
    {
        return $this->append("param.filter.project_id", "integer");
    }

    // GetTaskStatistics 验证场景定义
    public function sceneGetTaskStatistics()
    {
        return $this->append("param.filter.project_id", "integer");
    }

    // UpdateTodo 验证场景定义
    public function sceneUpdateTodo()
    {
        return $this->append("data.id", "require|integer");
    }

    // CreateTodo 验证场景定义
    public function sceneCreateTodo()
    {
        return $this->append("data", "require");
    }

    // GetTaskActiveManHour 验证场景定义
    public function sceneGetTaskActiveManHour()
    {
        return $this->append("param.filter", 'require|array');
    }

    // UpdateTaskDateByEntity 验证场景定义
    public function sceneUpdateTaskDateByEntity()
    {
        $this->append("param.entity_id", 'require|integer')
            ->append("param.start_time", 'require|date')
            ->append("param.end_time", 'require|date');
    }

    // GetProjectTaskAllLifeCycleStatistics 验证场景定义
    public function sceneGetProjectTaskAllLifeCycleStatistics()
    {
        return $this->append("type", 'require|in:shot,asset')
            ->append("param.filter", 'require|array')
            ->append("param.filter.project_id", 'require')
            ->append("param.filter.episode_id", 'require|integer');
    }

    //获取生命周期实体任务
    public function sceneGetLifeCycleStatisticsEntityTask()
    {
        return $this->append("type", 'require|in:shot,asset')
            ->append("param.filter", 'require|array')
            ->append("param.filter.entity_id", 'require')
            ->append("param.filter.step_category_id", 'require');
    }


    // GetProjectEpisodeTaskStatisticsStatus 验证场景定义
    public function sceneGetProjectEpisodeTaskStatisticsStatus()
    {
        return $this->append("project_id", 'require|integer');
    }

    // RefreshProjectEpisodeTaskStatisticsCache 验证场景定义
    public function sceneRefreshProjectEpisodeTaskStatisticsCache()
    {
        return $this->append("project_id", 'require|integer');
    }

    // GetProjectTaskAllLifeCycleStatistics 验证场景定义
    public function sceneGetProjectTaskAllLifeCycleStatisticsSearchList()
    {
        return $this->append("type", 'require|in:shot,asset')
            ->append("project_id", 'require');
    }

    // AutoGenerateEpisodesTask 验证场景定义
    public function sceneAutoGenerateEpisodesTask()
    {
        return $this->append('param.filter.project_id', 'require');
    }

    // GetProjectOkr 验证场景定义
    public function sceneGetProjectOkr()
    {
        return $this->append("param", "require")
            ->append("param.project_id", "require");
    }

    // GetExecutingTaskListGroupByStepCategory 验证场景定义
    public function sceneGetExecutingTaskListGroupByStepCategory()
    {
        return $this
            ->append("param", "array")
            ->append("param.page", "array");
    }

    // TaskCanStart 验证场景定义
    public function sceneTaskCanStart()
    {
        return $this->append("param.task_id", "require");
    }

    // CertCount 验证场景定义
    public function sceneCertCount()
    {
        return $this->append("param.start_date", "require|date")
            ->append("param.end_date", "require|date");
    }

    // StepTaskStandard 验证场景定义
    public function sceneStepTaskStandard()
    {
        return $this->append("param.filter", "require");
    }

    // GetDoneTaskListGrouped 验证场景定义
    public function sceneGetDoneTaskListGrouped()
    {
        return $this
            ->append("param", "array")
            ->append("param.page", "array");
    }

    // UpdateLatestVersionPackName 验证场景定义
    public function sceneUpdateLatestVersionPackName()
    {
        return $this
            ->append('data.id', 'require')
            ->append('data.pack_name', 'require')
            ->append('data.pack_pass', 'max:36');
    }

    // GetUpstreamLatestFileShareInfo 验证场景定义
    public function sceneGetUpstreamLatestFileShareInfo(): Task
    {
        return $this->append('param.id', 'require|integer');
    }

    // getEffectedTaskCount 验证场景定义
    public function sceneGetEffectedTaskCount(): Task
    {
        return $this->append('param.id', 'require|integer');
    }

    // Ready 验证场景定义
    public function sceneReady(): Task
    {
        return $this->append('param.id', 'require');
    }

    // IsPreStepCategoryStepTaskDone 验证场景定义
    public function sceneIsPreStepCategoryStepTaskDone(): Task
    {
        return $this->append('param.task_id', 'require|integer');
    }

    // GetEntityStepWorkflow 验证场景定义
    public function sceneGetEntityStepWorkflow(): Task
    {
        return $this->append('param.filter.entity_id', 'require|integer')
            ->append('param.filter.task_id', 'integer');
    }

    //获取指定项目任务详情工序 验证场景定义
    public function sceneGetEntityStepTaskDetails()
    {
        return $this->append('param.filter.entity_id', 'require')
            ->append('param.filter.task_id', 'require');
    }

    // 根据实体与任务映射获取二级工序任务详情信息 验证场景定义
    public function sceneGetEntityStepCategoryTask()
    {
        return $this->append('param.filter.entity_task', 'require|array');
    }

    // SetStepTaskAssigneeBatch 验证场景定义
    public function sceneSetStepTaskAssigneeBatch(): Task
    {
        return $this->append("tasks", "require|array");
    }

    // setStepTaskAssigneeItem 验证场景定义
    public function sceneSetStepTaskAssigneeItem(): Task
    {
        return $this->append("task_id", "require|integer")
            ->append("executor_id", "require|integer");
    }

    // GetCanAssignSupplierTaskTree 验证场景定义
    public function sceneGetCanAssignSupplierTaskTree()
    {
        return $this->append('param.filter.episode_id', 'require')
            ->append('param.filter.task_id', 'require|array');
    }

    // AssignTaskToSupplierBatch 验证场景定义
    public function sceneAssignTaskToSupplierBatch()
    {
        return $this->append('data', 'require|array');
    }

    public function sceneAssignTaskToSupplierItem()
    {
        return $this->append('user_id', 'require|integer')
            ->append('tenant_id', 'require|integer')
            ->append('task_id', 'require|integer')
            ->append('supplier_type', 'in:outside,tenant_group');
    }

    // EnsureAssignBatch 验证场景定义
    public function sceneEnsureAssignBatch()
    {
        return $this->append('param.filter', 'require');
    }

    // WaitConfirmAssetTaskList 验证场景定义
    public function sceneWaitConfirmAssetTaskList()
    {
        return $this->append('param.filter', 'require');
    }

    // HandleWaitConfirmTask 验证场景定义
    public function sceneHandleWaitConfirmTask()
    {
        return $this->append('param.filter', 'require')
            ->append('param.op', 'require|in:deny,accept');
    }

    // GetAssigningSupplierTaskTree 验证场景定义
    public function sceneGetAssigningSupplierTaskTree()
    {
        return $this->append('param.filter.task_id', 'require|array');
    }

    // UpdateTaskScheduleDate 验证场景定义
    public function sceneUpdateTaskScheduleDate()
    {
        return $this->append('data.id', 'require')
            ->append('data.plan_start_time', 'date')
            ->append('data.plan_end_time', 'date')
            ->append('data.manual_man_hour', 'float');
    }

    // GetTaskStepStandardDocument 验证场景定义
    public function sceneGetTaskStepStandardDocument()
    {
        return $this->append('param.filter.id', 'require');
    }

    // RevokeTaskAssigneeStatus 验证场景定义
    public function sceneRevokeTaskAssigneeStatus()
    {
        return $this->append('param.filter', 'require');
    }

    // getAssignStepCategoryFilter 验证场景定义
    public function sceneGetAssignStepCategoryFilter()
    {
        return $this->append('param.module_code', 'require');
    }

    // GetWaitAssignStepCategoryCount 验证场景定义
    public function sceneGetWaitAssignStepCategoryCount()
    {
        return $this->append('param.module_code', 'require')
            ->append('param.filter.episode_id', 'integer')
            ->append('param.filter.project_id', 'require|integer');
    }

    // CalculateTaskManHour 验证场景定义
    public function sceneCalculateTaskManHour()
    {
        return $this->append('param.task_id', 'require|integer');
    }

    // GetTaskList 验证场景定义
    public function sceneGetTaskList()
    {
        return $this
            ->append('param.filter.id', 'require')
            ->append('param.filter.step_category_id', 'require|integer')
            ->append('param.filter.episode_id', 'require|integer');
    }

    // QuickDone 验证场景定义
    public function sceneQuickDone()
    {
        return $this->append('data_list', 'require|array');
    }

    // QuickDoneItem 验证场景定义
    public function sceneQuickDoneItem()
    {
        return $this->append('id', 'require|integer')
            ->append('plan_start_time', 'require|date')
            ->append('plan_end_time', 'require|date')
            ->append('end_time', 'require|integer')
            ->append('union_id', 'integer');
    }

    // QueryTaskRelationMap 验证场景定义
    public function sceneQueryTaskRelationMap()
    {
        return $this->append('param.filter.id', 'require|integer');
    }

    // BatchSetStepTaskDepartmentId 验证场景定义
    public function sceneBatchSetStepTaskDepartmentId()
    {
        return $this->append('project_id', 'require|integer')
            ->append('data_list', 'require|array');
    }

    // BatchSetStepTaskDepartmentIdItem 验证场景定义
    public function sceneBatchSetStepTaskDepartmentIdItem()
    {
        return $this->append('task_id', 'require|integer')
            ->append('department_id', 'require|integer');
    }

    // GetOrderReAssignTaskList 验证场景定义
    public function sceneGetOrderReAssignTaskList()
    {
        return $this->append('param.filter.project_id', 'require|integer')
            ->append('param.filter.step_category_id', 'require|integer');

    }

    // GetTaskAssembleInfo 验证场景定义
    public function sceneGetTaskAssembleInfo()
    {
        return $this->append('param.filter.id', 'require|integer');
    }

    // TaskAssembleCallback 验证场景定义
    public function sceneTaskAssembleCallback()
    {
        return $this->append('param.filter.id', 'require|integer');
    }

    // GetTaskCountData 验证场景定义
    public function sceneGetTaskCountData()
    {
        return $this->append('type', 'require|in:assign_task,review_submit,review_submit_feedback')
            ->append('project_id', 'require|integer')
            ->append('filter', 'array')
            ->append('filter.episode_id', 'array')
            ->append('filter.step_category_id', 'array')
            ->append('filter.step_id', 'array');
    }

    // SyncTaskStatusToSourceTask 验证场景定义
    public function sceneSyncTaskStatusToSourceTask()
    {
        return $this->append('param.id', 'require|integer');
    }

    // AssignWithdraw 验证场景定义
    public function sceneAssignWithdraw()
    {
        return $this->append('param.filter', 'require|array');
    }

    //获取资产工序任务全生命周期
    public function sceneGetAssetStepTaskAllLifeCycle()
    {
        return $this->append('param.filter', 'array')
            ->append('param.skip_role_filter', 'in:yes,no');
    }

    //获取镜头工序任务全生命周期
    public function sceneGetShotStepTaskAllLifeCycle()
    {
        return $this->append('param.filter', 'require|array')
            ->append('param.filter.project_id', 'require')
            ->append('type', 'require|in:step,step_category');
    }

    //获取全生命周期相关数据统计
    public function sceneTaskAllLifeCycleLinkDataCount()
    {
        return $this->append('param.filter', 'require|array')
            ->append('param.filter.project_id', 'require')
            ->append('param.filter.step_type', 'require|in:step,step_category')
            ->append('param.filter.module', 'require|in:shot,asset');
    }

    // ChangeExecutor 验证场景定义
    public function sceneChangeExecutor()
    {
        return $this->append('data.id', 'require|integer')
            ->append('data.new_executor_id', 'require|integer')
            ->append('data.done_percent', 'require|integer|max:100|min:0');
    }

    public function sceneAcceptedShotTaskList()
    {
        return $this->append('param.filter', 'array')
            ->append('module_code', 'require|in:shot,sequence');
    }

    // CheckTaskCanAssemble 验证场景定义
    public function sceneCheckTaskCanAssemble()
    {
        return $this->append('param.id', 'require|integer');
    }

    public function sceneTaskStatus()
    {
        return $this->append('data.id', 'require|integer')
            ->append('data.status', 'require|in:Abo,Ena');
    }

    public function sceneGetUserReviewWorkFlow()
    {
        return $this->append('param.filter', 'require')
            ->append('param.filter.step_workflow_id', 'require|integer')
            ->append('param.filter.task_ids', 'require|array')
            ->append('param.filter.project_id', 'require|integer')
            ->append('param.filter.step_id', 'require');
    }

    public function sceneGetMarkedMultipleCheckList()
    {
        return $this->append('param.filter', 'require')
            ->append('param.filter.step_workflow_id', 'require|integer')
            ->append('param.filter.task_ids', 'require|array')
            ->append('param.filter.project_id', 'require|integer')
            ->append('param.filter.step_id', 'require');
    }

    public function sceneDismantleSetStepTask()
    {
        return $this->append('data', 'require')
            ->append('data.task_id', 'require|integer')
            ->append('data.dismantle_name', 'require|regex:/^[\x{4e00}-\x{9fa5}0-9a-zA-Z_]+$/u');
    }

    public function sceneDeleteDismantleTask()
    {
        return $this->append('data', 'require')
            ->append('data.id', 'require|integer');
    }

    // DesignVersions 验证场景定义
    public function sceneDesignVersions()
    {
        return $this->append('param.task_id', 'require|integer');
    }

    // SetProcessFile 验证场景定义
    public function sceneSetProcessFile()
    {
        return $this->append('data', 'require')
            ->append('data.cos_media', 'require')
            ->append('data.task_id', 'require|integer')
            ->append('data.file_name', 'require');
    }

    // SelectProcessFile 验证场景定义
    public function sceneSelectProcessFile()
    {
        return $this->append('param', 'require')
            ->append('param.filter', 'require')
            ->append('param.fields', 'require');
    }

    // Deprecated 验证场景定义
    public function sceneDeprecated()
    {
        return $this->append('param', 'require')
            ->append('param.task_id', 'require|integer')
            ->append('param.is_enable', 'require|in:yes,no');
    }

    // GetUpstreamRelationInfo  验证场景定义
    public function sceneGetUpstreamRelationInfo()
    {
        return $this->append('param.filter', 'require');
    }

    public function sceneSwitchTaskLock()
    {
        return $this->append('data', 'require')
            ->append('data.task_ids', 'require|array')
            ->append('data.is_lock', 'require|in:yes,no');
    }

    // ProductionInfoReport 验证场景定义
    public function sceneProductionInfoReport()
    {
        return $this->append('param.project_id', 'require');
    }

    // GetJsonReferenceAsset 验证场景定义
    public function sceneGetJsonReferenceAsset()
    {
        return $this->append('param.task_id', 'require');
    }

    // 发布前的子拆解任务自定义验证场景
    public function sceneCheckWhetherExistUnfinishedSubtask()
    {
        return $this->append('task_id', 'require');
    }

    // GetDailyDeliveryTaskList 获取每日交付率自定义验证场景
    public function sceneGetDailyDeliveryTaskList()
    {
        return $this->append('param.project_id', 'require')
            ->append('param.delivery_time', 'require|array');
    }
}
